
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 
	<head>
	<meta name="renderer" content="webkit"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="IE=9" http-equiv="X-UA-Compatible" />
		<title>后台登陆</title>
		<link rel="stylesheet" href="__CSS__reset.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="__CSS__style.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="__CSS__invalid.css" type="text/css" media="screen" />	
		<link rel="stylesheet" href="__CSS__blue.css" type="text/css" media="screen" />
		<script type="text/javascript" src="__JS__jquery-1.10.2.js"></script>
	</head>
	<style>
	*{font:14px/20px 微软雅黑;}
	</style>
		<body id="login">
		<div id="login-wrapper" class="png_bg">
			<div id="login-top">
				<h1>后台管理</h1>
				<img id="logo" src="__IMG__logo.png" alt="Simpla Admin logo" />
			</div> 
			<div id="login-content">
			   <form class="form-horizontal" role="form" method="post">
					<div class="notification information png_bg">
						<div id="tishi">
							请输入账号密码！
						</div>
					</div>
					<p>
						<label>账号：</label>
						<input class="text-input" type="text"   name="name"  id="name"/>
					</p>
					<div class="clear"></div>
					<p>
						<label>密码：</label>
						<input class="text-input" type="password"  name="password" id="password"/>
					</p>
					<div class="clear"></div>
					<p id="remember-password">
						<input type="checkbox"  id="interests"/>记住密码
					</p>
					<div class="clear"></div>
					<p>
						<input class="button" type="button"  value="登录"  id="tijiao"/>
					</p>
				</form>
			</div>
		</div> 
		        <script>
            $(function(){
                $("#tijiao").click(function(){
                    var name = $("#name").val();
                    var password = $("#password").val();
                    var interests = $("#interests").is(':checked');
                    if (interests) {
                        interests = 1;
                    }
                    else {
                        interests = 0;
                    }
                    if (str_cheak(name)) { //检查用户名
                        if (str_cheak(password)) { //检查密码
                            $.post("/admin/logining/login", {
                                name: name,
                                password: password,
                                interests: interests,
                            }, function(data){
                                if (data) {
                                    location.href = "/admin";
                                }
                                else {
                                   $("#tishi").html("密码错误!");
                                }
                            });
                        }
                        else {
                            $("#tishi").html("密码输入不合法!!");
                            return false;
                        };
                                }
                    else {
                        $("#tishi").html("用户名输入不合法!!");
                        return false;
                    }
                    return false;
                });
            });
            //防止sql注入
            function str_cheak(val1){
                if (val1 == "" || val1 == null || !/^([A-Z]|[a-z]|[\d])*$/.test(val1) || /select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile/.test(val1)) {
                    return false;
                }
                else {
                    return true;
                }
            }
        </script>
  </body>
</html>
	


